import request from '@/utils/request'

// 账号
export function getAccountList (data) {
  console.info(data,'getAccountList')
  const params = {
    filtering: [],
    order_by: data.order_by,
    order_type: data.order_type,
    keyword:data.keyWord,
    page: data.page,
    page_size: data.page_size
  }
  if (data.status) {
    params.filtering.push({
      field: 'status',
      operator: 'EQUALS',
      value: data.status
    })
  }
  if (data.created_at && data.created_at.length > 0) {
    params.filtering.push({
      field: 'created_at',
      operator: 'GREATER_EQUALS',
      value: data.created_at[0]
    })
    params.filtering.push({
      field: 'created_at',
      operator: 'LESS_EQUALS',
      value: data.created_at[1]
    })
  }
  return request({
    url: process.env.VUE_APP_ADV_OCEAN_API +  '/admin/ocean/account/select',
    method:'post',
    data: params
  })
}

// 投放账户（无分页）
export function getAccountListGet (data) {
  const params = {
    keyword:data.keyWord,
    filtering: []
  }
  if (data.status) {
    params.filtering.push({
      field: 'status',
      operator: 'EQUALS',
      value: data.status
    })
  }
  return request({
    url: process.env.VUE_APP_ADV_OCEAN_API + '/admin/ocean/account/get',
    method:'post',
    data: params
  })
}